package com.ruoyi.system.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.ruoyi.system.dao.PmsFirstAidDao;
import com.ruoyi.system.domain.po.DmsCt;
import com.ruoyi.system.domain.po.DmsCtExample;
import com.ruoyi.system.domain.vo.PmsFirstAidVo;
import com.ruoyi.system.mapper.DmsCtMapper;
import com.ruoyi.system.service.PatientService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

@Service
public class PatientServiceImpl implements PatientService {

    @Resource
    private DmsCtMapper dmsCtMapper;
    @Resource
    private PmsFirstAidDao firstAidDao;

    @Override
    public List<String> getCtUrl(Long patientId) {
        DmsCtExample dmsCtExample = new DmsCtExample();
        dmsCtExample.createCriteria().andDelFlagEqualTo((byte) 0).andPatientIdEqualTo(patientId);
        List<DmsCt> dmsCts = dmsCtMapper.selectByExample(dmsCtExample);
        if (CollectionUtil.isNotEmpty(dmsCts)) {
            return dmsCts.stream().map(DmsCt::getYxdz).collect(Collectors.toList());
        }
        return null;
    }

    @Override
    public List<PmsFirstAidVo.CtResult> getCt(Long patientId) {
        return firstAidDao.queryCtList("");
    }
}
